﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _10.桥接模式
{
    class Program
    {
        static void Main(string[] args)
        {
            ISoftware wechat = new WeChat();
            ISoftware qq = new QQ();

            Console.WriteLine("ios系统运行软件：");
            System ios = new IOS();
            ios.Run(wechat);
            ios.Run(qq);

            Console.WriteLine("");

            Console.WriteLine("Android系统运行软件：");
            System android = new Android();
            ios.Run(wechat);
            ios.Run(qq);

            Console.Read();
 
        }
    }
    public interface ISoftware
    {
        void Running();
    }
    public class WeChat : ISoftware
    {
        public void Running()
        {
            Console.WriteLine("微信已经运行");
        }
    }
    public class QQ : ISoftware
    {
        public void Running()
        {
            Console.WriteLine("QQ已经运行");
        }
    }
    public abstract class System
    {
        public abstract void Run(ISoftware software);
    }
    public class IOS : System
    {
        public override void Run(ISoftware software)
        {
            Console.WriteLine("欢迎来到IOS系统");
            software.Running();
        }
    }
    public class Android : System
    {
        public override void Run(ISoftware software)
        {
            Console.WriteLine("欢迎来到Android系统");
            software.Running();
        }
    }
 
}
